import React, { Component } from 'react'
import QcEventEmitter from "../util/qcevents"
export class Top extends Component {
    state = {
        selIndex:0
    }
    componentDidMount () {
        console.log(this.props.send)
    }
    fn(ind){
        console.log(ind)
        this.setState({
            selIndex:ind
        })
        QcEventEmitter.emit("zhao",ind)
    }
    render() {
       
        return (
            <div>
                {
                    this.props.send&& this.props.send.length? this.props.send.map((item,index)=>{
                        return  <span key={index} onClick={this.fn.bind(this,index)} className={index==this.state.selIndex?"active":""}>{item.tit}</span>
                    }):""
                }
               
            </div>
        )
    }
}

export default Top
